<template>
	<input type="hidden" v-model="value"/>
</template>

<script>
	import utils from '@/utils/utils.js';
	import formDesignerUtil from '@/utils/formDesignerUtil.js';
	export default {
		name: "DesignTextComponent",
		props: [
			"componentModel"
		],
		data() {
			return {
				value:"",
				selected:false,
				"propertySet": [
					{
						"key": "ID","label":"ID","editor":"label"
					},
					{
						"key": "dataSource","label":"数据源","editor":"select"
					},
					{
						"key": "dataField","label":"数据域","editor":"text"
					},
					{
						"key": "varName","label":"变量名","editor":"text"
					}
				]
			}
		},inject:['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			onClickHandler(){
				formDesignerUtil.componentClickHandler(this);
			},getPropertyValue(propertyKey){
				if(propertyKey=="ID"){
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"id");
				}
				return formDesignerUtil.getComponentModelCommonValue(this.componentModel,propertyKey);
			},setPropertyValue(propertyKey,propertyValue){
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,propertyKey, propertyValue);
				if(propertyKey=="col"){
					formDesignerUtil.setComponentModelPropValue(this.componentModel,"col",parseInt(propertyValue));
				}else if(propertyKey=="labelExpression"){
					formDesignerUtil.setComponentModelPropValue(this.componentModel,"labelExpression",propertyValue);
				}
			},setSelected(selected){
				this.selected=selected;	
			}
		}
	}
</script>

<style>
</style>
